<!DOCTYPE html>
<html lang="en">
<head>
<#include "/common/head.ftl"/>
<script type="text/javascript">
	$(function() {

	});
	function submitForm() {
		var userAccount = $.trim($("#userAccount").val());
		var userPassword = $.trim($("#userPassword").val());

		if (userAccount != "" && userPassword != "") {
			$.post($("#form1").attr("action"), $("#form1").serialize(),
					function(data) {
						var result = $.parseJSON(data);
						if (result.code == 0) {
							window.location.href = result.url;
						} else {
							$("#userAccountValid").text(result.message);
							$("#userPassword").val("");
							return false;
						}
					});
		} else {
			$("#userAccountValid").text("请输入账号和密码!");
			return false;

		}
	}
	function isWeiXin(){
		var ua = window.navigator.userAgent.toLowerCase();
		var isWeiXin = 1;
    	if(ua.match(/MicroMessenger/i) == 'micromessenger'){
        	isWeiXin = 1;
    	}else{
        	isWeiXin = 2;
    	}
    	console.log("isWeiXin="+isWeiXin);
    	window.location.href='${path}/user/toOauthwx?isWeiXin='+isWeiXin;
	}
</script>
</head>
<body>
	<#include "/common/header.ftl"/>
	<div class="wrap">
		<div class="container">
			<div class="container-bd">
				<div class="log-form">
					<form id="form1" name="form1" method="post"
						action="${path}/user/login" method="post">
						<div class="line">
							<div class="input">
								<input type="text" name="userAccount" id="userAccount"
									class="username" placeholder="手机号码/邮箱">
							</div>
						</div>
						<div class="line">
							<div class="input">
								<input type="password" name="userPassword" id="userPassword"
									class="psd" placeholder="密码" />
							</div>
						</div>
						<div>
							<span id="userAccountValid" style="color: red;"></span>
						</div>
						<div class="logform">
							<input type="button" class="login" onclick="submitForm();"
								value="登录" />
						</div>
					</form>
					<div class="else">
						<a class="forget f36 c646464 fl" href="#"
							onclick="alert('请联系客服QQ：3297103307申请重置密码！')">忘记密码？</a> <a
							class="register f36 c646464 fr" href="${path}/user/toRegister">注册新账户</a>
					</div>
					<div class="qwlogin">
						<span>【第三方账号登录】</span> <a href="${path}/user/toOauthqq"><img
							src="${path}/image/qq-login.png" alt="用QQ账号登录" border="0"></a>
						
						<!--<a href="${path}/user/toOauthwb"><img
							src="${path}/image/weibo_login.gif" alt="用新浪微博账号登录" border="0"></a>
						-->
						<a href="javascript:void(0);" onclick="isWeiXin()"><img
							src="${path}/image/weixin-login.png" alt="用微信账号登录" border="0"></a>
					</div>
				</div>
			</div>
		</div>
	</div>
	<#include "/common/footer.ftl"/>
</body>
</html>